<?php
namespace app\admin\validate;

use think\Validate;

class RoleValidate extends Validate
{
    protected $rule =   [
        'id'          => 'require|number',
        'page'        => 'require|number',
        'limit'       => 'require|number',
        'menu'        => 'require',
        'name'        => 'require|length:1,30',
    ];
    
    protected $message  =   [
        'id.require'          => 'ID必须',
        'id.number'           => 'ID必须是数字',
        'page.require'        => '页数不能为空',
        'page.number'         => '页数数据类型错误',
        'limit.require'       => '条数不能为空',
        'limit.number'        => '条数数据类型错误',
        'menu.require'        => '权限不能为空',
        'name.require'        => '名称不能为空',
        'name.length'         => '名称长度错误',
    ];
    
    protected $scene = [
        'show'         => ['id'],
        'list'         => ['page', 'limit'],
        'edit'         => ['id', 'name', 'menu'],
        'add'          => ['name', 'menu'],
    ];
}